﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NhanAi.Entity;
using NhanAi.DAO;
using NhanAi.DAO.Mix;
using NhanAi.App_Code;

namespace NhanAi.Public
{
    public partial class Index : PublicBasePage
    {
        List<Taxonomy> taxonomies;       
        SortedList<int, List<Post>> posts;
        public List<Taxonomy> Taxonomies { get { return taxonomies; } }
        public SortedList<int, List<Post>> Posts { get { return posts; } }

        protected override void InitializeCulture()
        {
            base.InitializeCulture();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            PostModel postDao = new PostModel();
            TaxonomyDao daoTax = new TaxonomyDao();
            List<Taxonomy> taxs = daoTax.ReadAll(0);
            SortedList<int, List<Post>> posts = new SortedList<int, List<Post>>();
            foreach (Taxonomy t in taxs)
            {
                int total = 0;
                List<Post> postList = postDao.ReadByTaxonomy(5, 1, CurrentLanguageCode, "post", t.Id,null, false, -1, NAConstants.POST_STA_POST, null, null, out total);
               posts.Add(t.Id, postList);
                
            }
            this.taxonomies = taxs;
            this.posts = posts;
          
        }
    }
}